<include file="Public/header"/>
<div class="row">
    <div class="wrapper wrapper-content animated">
        <div class="ibox-content">
            <div class="deal-bd order-bottom">登录密码</div>
            <div class="layui-tab">
                <ul class="layui-tab-title">
                    <li class=""><a href="<{:U('Account/profile')}>">商户基本信息</a></li>
                    <li class=""><a href="<{:U('Account/bankcard')}>">银行卡管理</a></li>
                    <li class="layui-this"><a href="<{:U('Account/editPassword')}>">登录密码</a></li>
                    <li class=""><a href="<{:U('Account/editPaypassword')}>">支付密码</a></li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form" action="" autocomplete="off" id="profile">
                            <input type="hidden" name="id" value="<{$p.id}>">
                            <div class="layui-form-item">
                                <div class="layui-block">
                                    <label class="layui-form-label" style="width:110px">原登录密码：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="password" name="p[oldpwd]" lay-verify="required" autocomplete="off"
                                               placeholder="" class="layui-input" value="">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-block">
                                    <label class="layui-form-label" style="width:110px">新登录密码：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="password" name="p[newpwd]" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:110px">重复新密码：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="password" name="p[secondpwd]" lay-verify="title" autocomplete="off"
                                               placeholder="" class="layui-input" value="">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"></label>
                                    <button class="btn btn-primary" lay-submit="" lay-filter="profile" data-mobile="">提交保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="Public/footer"/>
<script>
    //短信验证是否开启
    var sms_is_open = "<{$sms_is_open}>";
    layui.use(['laydate', 'laypage', 'layer', 'form', 'element'], function() {
        var laydate = layui.laydate //日期
            ,layer = layui.layer //弹层
            ,form = layui.form //弹层
            , element = layui.element; //元素操作
        //日期
        laydate.render({
            elem: '#date'
        });
        //监听提交
        form.on('submit(profile)', function(data){
            $.ajax({
            url:"<{:U('Account/editPassword')}>",
            type:"post",
            data:$('#profile').serialize(),
            success:function(res){
                if(res.status){
                    layer.alert("编辑成功", {icon: 6},function () {
                        parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }else{
                    layer.alert(res.msg ? res.msg :"操作失败", {icon: 5},function () {
                        parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }
            }
        });
            return false;
        });
    });
</script>
</body>
</html>